<!--==============================================
=            Call to Action Subscribe            =
===============================================-->
{{ if site.Params.Subscription.enable }}
{{ with site.Params.Subscription }}
<section class="cta-subscribe bg-subscribe overlay-dark">
	<div class="container">
		<div class="row">
			<div class="col-md-6 mr-auto">
				<!-- Subscribe Content -->
				<div class="content">
					<h3>{{ .title | markdownify }}</h3>
					<p>{{ .content | markdownify }}</p>
				</div>
			</div>
			<div class="col-md-6 ml-auto align-self-center">
				<!-- Subscription form -->
				<form class="row" action="{{ .mailchimp_form_action }}" method="post" name="mc-embedded-subscribe-form" target="_blank">
					<div class="col-lg-8 col-md-12">
						<input type="email" class="form-control main white mb-lg-0" placeholder="Email">
					</div>
					<div class="col-lg-4 col-md-12">
						<div class="subscribe-button">
							<button class="btn btn-main-md" type="submit" name="subscribe">Subscribe</button>
						</div>
					</div>
					<div style="position: absolute; left: -5000px;" aria-hidden="true">
						<input type="text" name="{{ .mailchimp_form_name }}" tabindex="-1">
					</div>
				</form>
			</div>
		</div>
	</div>
</section>
{{ end }}
{{ end }}
<!--====  End of Call to Action Subscribe  ====-->

<!--================================
=            Open Street Map            =
=================================-->

{{ if site.Params.map.enable }}
{{ with site.Params.map }}
<a id="venueMap"></a>
<section class="map" >
	<!-- Open Street Map -->

  <div id="map" width="100%" style="height:550px">
  {{ partial "map.html" $ }}
  </div>

	<div class="address-block" style="position:absolute;z-index:1000">
		<h4>{{i18n "Shenzhen" }}</h4>
		<ul class="address-list p-0 m-0">
			<li><i class="fa fa-home"></i><span>{{ i18n "Conference_Actual_Address"  }}</span></li>
			<li><i class="fa fa-envelope"></i><span>{{ .email | markdownify}}</span></li>
		</ul>
		<a id="btn_get_direction" target="_blank" class="btn btn-white-md">{{  i18n "Get_Directions"  }}</a>
	</div>
</section>
{{ end }}
{{ end }}
<!--====  End of Open Street Map  ====-->

<!--============================
=            Footer            =
=============================-->

<footer class="footer-main">
	<div class="container">
		<div class="row">
			<div class="col-md-12">
				<div class="block text-center">
					<div class="footer-logo">
						<a class="navbar-brand" href="{{ site.BaseURL | relLangURL }}">
							{{ if site.Params.logo }}
							<img class="img-fluid" width="{{site.Params.logo_width}}" src="{{ site.Params.logo_footer | absURL}}"
								alt="{{ site.Title }}">
							{{ else }}
							{{site.Title}}
							{{ end }}
						</a>
					</div>
					<ul class="social-links-footer list-inline">
						{{ range site.Params.social}}
						<li class="list-inline-item">
							<a href="{{ .link | safeURL }}"><i class="fa-brands {{.icon}}"></i></a>
						</li>
						{{ end }}
					</ul>
				</div>
			</div>
		</div>
	</div>
</footer>
<!-- Subfooter -->
<footer class="subfooter">
	<div class="hu-bian"><div class="bg"></div></div>
	<div class="container">
		<div class="row">
			<div class="col-md-6 align-self-center">
				<div class="copyright-text">
					<p>{{site.Params.copyright | markdownify }}</p>
				</div>
			</div>
			<div class="col-md-6">
				<a href="#" class="to-top"><i class="fa fa-angle-up"></i></a>
			</div>
		</div>
	</div>
</footer>


{{ "<!-- Google Map API -->" | safeHTML }}
{{ with site.Params.map.gmap_api }}
<script src="{{ . | safeURL }}"></script>
{{ end }}

{{ "<!-- JS Plugins -->" | safeHTML }}
{{ range site.Params.plugins.js}}
<script src="{{ .link | absURL }}" {{.attributes | safeHTMLAttr}}></script>
{{ end }}

{{ "<!-- Main Script -->" | safeHTML }}
{{ $script := resources.Get "js/script.js" | minify }}
<script src="{{ $script.Permalink }}"></script>


<!-- cookie -->
{{ if site.Params.cookies.enable }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.2.1/js.cookie.min.js"></script>
<div id="js-cookie-box" class="cookie-box cookie-box-hide">
	This site uses cookies. By continuing to use this website, you agree to their use. <span id="js-cookie-button"
		class="btn btn-main-sm ml-2">I Accept</span>
</div>
<script>
	(function ($) {
		const cookieBox = document.getElementById('js-cookie-box');
		const cookieButton = document.getElementById('js-cookie-button');
		if (!Cookies.get('cookie-box')) {
			cookieBox.classList.remove('cookie-box-hide');
			cookieButton.onclick = function () {
				Cookies.set('cookie-box', true, {
					expires: {{site.Params.cookies.expire_days}}
				});
				cookieBox.classList.add('cookie-box-hide');
			};
		}
	})(jQuery);



  //唤起百度地图
  function openBaiduMap(lng, lat, address, lat11, lng11) {
    var geolocation = new BMap.Geolocation();
    // 开启定位控件
    geolocation.enableSDKLocation();
    geolocation.getCurrentPosition(function (result) {

      var queryString;
      if (this.getStatus() == BMAP_STATUS_SUCCESS) {
        console.log('11')
        queryString = `origin=latlng:${result.point.lat},${result.point.lng}|name:我的位置&destination=latlng:${lat},${lng}|name:${address}&mode=driving&coord_type=bd09ll&src=com.mzwu.www`;
      } else {
        console.log('22')

        queryString = `origin=latlng:${lat11},${lng11}|name:我的位置&destination=latlng:${lat},${lng}|name:${address}&mode=driving&coord_type=bd09ll&src=com.mzwu.www`;

        // var queryString = `origin=latlng:28.238681,116.608768|name:我的位置&destination=latlng:${lat},${lng}|name:${address}&mode=driving&coord_type=bd09ll&src=com.mzwu.www`;

      }
      var app_url = `baidumap://map/direction?${queryString}`;
      var web_url = `http://api.map.baidu.com/direction?${queryString}&region=中国&output=html`;
      // https://map.baidu.com/dir/%E6%88%91%E7%9A%84%E4%BD%8D%E7%BD%AE/%E5%9C%B0%E5%9D%80%E4%B8%80/@11599509.985,3557925.135,7z?querytype=nav&sn=1$$$$12127997.03,4051196.53$$%E6%88%91%E7%9A%84%E4%BD%8D%E7%BD%AE$$$$$$&en=1$$$$11871379.04,3060815.7$$%E5%9C%B0%E5%9D%80%E4%B8%80$$$$$$&c=233&version=4&route_traffic=1&mrs=1&da_src=shareurl
      //尝试唤起百度地图App
      window.location.href = app_url;


      //唤起失败打开Web版百度地图
      var startTime = Date.now();
      var count = 0;

      var t = setInterval(function () {
        if (++count < 30) {
          return;
        }
        if (Date.now() - startTime > 800) {
          clearInterval(t);
        }
        if (!(document.hidden || document.webkitHidden)) {
          window.location.href = web_url;
          // window.open(web_url,'_bank')//浏览器会拦截

        }
      }, 20);

      window.onblur = function () {
        clearInterval(t);
      };
    });
  }


  document.getElementById("btn_get_direction").addEventListener("click", function () {
    let lngNum;
    let latNum;

    function myFun(result) {
      console.log(result)//获取当前所在市的信息，主要为了pc端和ios系统获取不到精准位置用的
      lngNum = result.center.lng;
      latNum = result.center.lat;
      openBaiduMap(point.lng, point.lat, name, latNum, lngNum);//调起百度地图

    }
    var myCity = new BMap.LocalCity();
    myCity.get(myFun);

  }
  )




</script>
<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=OZ2trfKMiZwOw0Zj8kdq9COsoYXZAu47"></script>


<!-- cookie style -->
<style>
	.cookie-box {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		text-align: center;
		z-index: 9999;
		padding: 1rem 2rem;
		background: rgb(71, 71, 71);
		transition: all .75s cubic-bezier(.19, 1, .22, 1);
		color: #fdfdfd;
	}

	.cookie-box-hide {
		display: none;
	}
</style>
{{ end }}
